package org.maxkey.portal.core.search;


import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Transient;

@SuppressWarnings("serial")
@Getter
@Setter
public class ParamModel<T> implements java.io.Serializable{

    /**
     * 开始页
     */
    private int pageNo;

    /**
     * 查询数据量
     */
    private int pageSize;


    private T condition;


    public int getPageNo(){
        if(this.pageNo > 0){
            pageNo=pageNo-1;
        }else{
            pageNo = 0;
        }
        return pageNo;
    }

    /**
     * 获取分页数量，不能超过1000以及不能小于10
     * @return
     */
    public int getPageSize(){
        if(this.pageSize >= 1000){
            pageSize=1000;
        }else if(this.pageSize <= 10){
            pageSize=10;
        }
        return pageSize;
    }


}
